#include<bits/stdc++.h>
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define mid ((l+r)>>1)
#define File(xxx) freopen(xxx".in","r",stdin),freopen(xxx".out","w",stdout)
using namespace std;
namespace IO{
    char buff[1<<21],*p1=buff,*p2=buff;
    char getch(){
        return p1==p2&&(p2=((p1=buff)+fread(buff,1,1<<21,stdin)),p1==p2)?EOF:*p1++;
    }
    template<typename T>
    void read(T &x){
        char ch=getch();int fl=1;x=0;
        while(ch>'9'||ch<'0'){if(ch=='-')fl=-1;ch=getch();}
        while(ch<='9'&&ch>='0'){x=x*10+ch-48;ch=getch();}
        x*=fl;
    }
    template<typename T,typename ...Args>
    void read(T &x,Args& ...args){
        read(x);read(args...);
    }
    char obuf[1<<21],*p3=obuf;
    void putch(char ch){
        if(p3-obuf<(1<<21))*p3++=ch;
        else fwrite(obuf,p3-obuf,1,stdout),p3=obuf,*p3++=ch;
    }
    void pc(const char *s){
    	while(*s)putch(*s),s++;
    }
    char ch[100];
    template<typename T>
    void write(T x){
        if(!x)return putch('0');
        if(x<0)putch('-'),x*=-1;
        int top=0;
        while(x)ch[++top]=x%10+48,x/=10;
        while(top)putch(ch[top]),top--;
    }
    template<typename T,typename ...Args>
    void write(T x,Args ...args){
        write(x),putch(' '),write(args...);
    }
    void flush(){fwrite(obuf,p3-obuf,1,stdout);p3=obuf;}
}
using namespace IO;
const int B=60,mod=1e9+7;
inline int Mod(int x){return x>=mod?x-mod:x;}
inline ll lowbit(ll x){return x&(-x);}
struct node{int a[B][B];};
node operator *(node a,node b){
	node c;
	memset(c.a,0,sizeof c.a);
	for(int i=0;i<B;i++)
		for(int j=0;j<B;j++)
			for(int k=0;k<B;k++)
				c.a[i][k]=Mod(c.a[i][k]+1ll*a.a[i][j]*b.a[j][k]%mod);
	return c;
}
node f[B],g[B],h[B];
int ans[B],tmp[B];
void Work(int ops,int t){
	memset(tmp,0,sizeof tmp);
	if(ops==0){
		for(int i=0;i<B;i++)
			for(int j=0;j<B;j++)
				tmp[j]=Mod(tmp[j]+1ll*ans[i]*f[t].a[i][j]%mod);
	}
	if(ops==1){
		for(int i=0;i<B;i++)
			for(int j=0;j<B;j++)
				tmp[j]=Mod(tmp[j]+1ll*ans[i]*g[t].a[i][j]%mod);
	}
	if(ops==2){
		for(int i=0;i<B;i++)
			for(int j=0;j<B;j++)
				tmp[j]=Mod(tmp[j]+1ll*ans[i]*h[t].a[i][j]%mod);
	}
	swap(tmp,ans);
	return;
}
void Calc(ll x,ll y){
	while(x+lowbit(x)<=y){
		ll tmp=lowbit(x);
		if(tmp!=1){
			int t=__lg(tmp);
			Work(1,t-1);
		}
		x+=tmp-1;
		int t=0;
		while((x>>t)&1)t++;
		Work(2,t);
		x++;
	}
	for(int i=B-1;i>=0;i--)
		if(((x^y)>>i)&1)Work(0,i),x+=(1ll<<i);
}
signed main(){
	File("op");
	for(int i=0;i<B;i++){
		for(int j=0;j<B;j++)
			h[i].a[j][j]=1;
		for(int j=0;j<=i&&j<B;j++)
			for(int k=0;k<=j;k++)
				h[i].a[j][k]=1;
	}
	f[0]=g[0]=h[0];
	for(int i=1;i<B;i++)
		f[i]=g[i-1]*h[i],
		g[i]=f[i]*g[i-1];
	
	ll x,y;
	read(x,y);
	for(int i=0;i<B;i++){
		for(int j=0;j<=i;j++)
			ans[j]=Mod(ans[j]+1);
		if((x<<1)>y){
			Calc(x,y);
			break;
		}else Calc(x,x<<1),x<<=1;
	}
	write(ans[0]);
	return flush(),0;
}

